// pages/login/login.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    that.setData({
      id:options.id
    })
  },

  getUserInfo:function(e){
    console.log(e.detail.userInfo)
    var userinfo = wx.getStorageSync('userinfo')
    wx.request({
      url:getApp().globalData.url+"setuserinfo/",
      data:{
        nickname:e.detail.userInfo.nickName,
        head_img:e.detail.userInfo.avatarUrl,
        openid:userinfo.openid,
        type:"set_name"
      },
      header:{
         "Content-Type":"application/json"
      },
     
      success: (result) => {
        wx.setStorage({
          key:"userinfo",
          data:{
            openid:userinfo.openid,
            nickname:e.detail.userInfo.nickName
          }
        })
        wx.switchTab({
          url: "/pages/demo3/demo3",
          
        })
      },

    })
  },

})